package com.wwb.collect.mapper;

import com.ruoyi.common.core.mapper.BaseMapperPlus;
import com.wwb.collect.domain.ErpWwbCollectProduct;
import com.wwb.collect.domain.vo.ErpWwbCollectProductVo;
import org.apache.ibatis.annotations.Select;

import java.util.List;


/**
 * 采微唯宝供应链采集商品表Mapper接口
 *
 * @author erp
 * @date 2023-03-07
 */
public interface ErpWwbCollectProductMapper
        extends BaseMapperPlus<ErpWwbCollectProductMapper, ErpWwbCollectProduct, ErpWwbCollectProductVo> {

    /**
     * @Description: 获取最大ID
     * @Author: j.zh
     * @Date: 2024/6/13
     * @return
     * @Version: 4.0.0
    **/
    @Select("SELECT MAX(id) FROM erp_wwb_collect_product")
    Long selectMaxId();

    /**
     * @Description: 获取已编辑的最大ID
     * @Author: j.zh
     * @Date: 2024/6/13
     * @return
     * @Version: 4.0.0
     **/
    @Select("SELECT MAX(id) FROM erp_wwb_collect_product where operate_type = 1")
    Long selectMaxIdByOperateType();

    /**
     * @Description: 图省事，直接查询粗过滤的列表，且没有精细过滤的，即主表operate_type=1，expand表edit_status=0
     * @Author: j.zh
     * @Date: 2024/6/17
     * @return
     * @Version: 4.0.0
    **/
    @Select("SELECT a.* FROM erp_wwb_collect_product a LEFT JOIN erp_wwb_collect_product_expand b ON a.id = b.collect_product_id WHERE a.operate_type = 1 AND (b.edit_status = 0 OR b.edit_status is NULL)")
    List<ErpWwbCollectProduct> selectGeneralFilteringList();
}
